﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPageAdmin.master" AutoEventWireup="true" CodeFile="Add_permission.aspx.cs" Inherits="Admin_Add_permission" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style8
        {
            text-align: center;
        }
        .style9
        {
            width: 28px;
        }
        .style10
        {
            text-align: right;
            width: 453px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table class="style7">
        <tr>
            <td colspan="3" style="font-weight: 700; text-align: center; color: #0066FF">
                <asp:Label ID="Label1" runat="server" Text="Add Permission"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style10">
                &nbsp;</td>
            <td class="style9">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style10">
                <asp:Label ID="Label2" runat="server" Text="Role Id"></asp:Label>
            </td>
            <td class="style9">
                &nbsp;</td>
            <td>
                <asp:TextBox ID="txtRoleId" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style10">
                <asp:Label ID="Label3" runat="server" Text="Module Id"></asp:Label>
            </td>
            <td class="style9">
                &nbsp;</td>
            <td>
                <asp:TextBox ID="txtModuleId" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style8" colspan="3">
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                    DeleteCommand="DELETE FROM [tblPermisson] WHERE [roleId] = @roleId AND [moduleId] = @moduleId" 
                    InsertCommand="INSERT INTO [tblPermisson] ([roleId], [moduleId]) VALUES (@roleId, @moduleId)" 
                    SelectCommand="SELECT * FROM [tblPermisson]" 
                    UpdateCommand="UPDATE [tblPermission] SET [moduleId]=@moduleId WHERE [roleId]=@roleId">
                    <DeleteParameters>
                        <asp:Parameter Name="roleId" Type="Int32" />
                        <asp:Parameter Name="moduleId" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:ControlParameter ControlID="txtRoleId" Name="roleId" PropertyName="Text" 
                            Type="Int32" />
                        <asp:ControlParameter ControlID="txtModuleId" Name="moduleId" 
                            PropertyName="Text" Type="Int32" />
                    </InsertParameters>
                </asp:SqlDataSource>
                <asp:Button ID="btnAdd" runat="server" onclick="btnAdd_Click" Text="Add" />
            </td>
        </tr>
    </table>
</asp:Content>

